package com.solcoo.merchant.ui.reg;

import android.content.Intent;
import android.os.Bundle;
import android.widget.Button;
import android.widget.EditText;

import com.solcoo.merchant.R;
import com.solcoo.merchant.base.BaseActivity;
import com.solcoo.merchant.ui.reg.CheckCodeClickListener.CheckCodeCallBack;
import com.solcoo.merchant.ui.reg.CheckCodeClickListener.PhoneNoLoader;

public class GetCheckCodeActivity extends BaseActivity {

	private EditText phoneNoEditText;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.get_check_code);
		Button btn = (Button) findViewById(R.id.get_check_code_btn);
		phoneNoEditText = (EditText) findViewById(R.id.phone_no);
		btn.setOnClickListener(new CheckCodeClickListener(mPhoneNoLoader, this,
				callback));
	}

	private PhoneNoLoader mPhoneNoLoader = new PhoneNoLoader() {
		@Override
		public String getPhoneNo() {
			return phoneNoEditText.getText().toString();
		}
	};
	private CheckCodeCallBack callback = new CheckCodeCallBack() {

		@Override
		public void onGetCode(String code) {
			Intent it = new Intent(GetCheckCodeActivity.this, RegActivity.class);
			it.putExtra("checkcode", code);
			it.putExtra("phoneNo", mPhoneNoLoader.getPhoneNo());
			startActivity(it);
		}
	};

}
